Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. How can I stop custom link items in the menu jumping to the VERY top of the page

How can I stop custom link items in the menu jumping to the VERY top of the page

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 209 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    J KMB
    wrote on last edited by
    #1

    Hello,

    I'm having a little trouble with some CSS on a website I'm working on and wondered if anyone could help me please. I am a beginner so apologies if this is basic stuff, but I'm a little out of my depth.

    I have a menu that uses custom links to jump to sections of a one page website. I do this with appearance>menus>add menu item>custom link> URL: #05 and then in the source code of the text box in gridder I add <a name="05">anchored item</a> .

    However, when I click the menu item at the top and it jumps down the page to the anchor tag, the tagged item appears at the very top of the browser window. I would like to have a little padding between the top of the screen and the tagged item.

    I understand from research (google) a good way to do this is the the ::before CSS selector.
    for example:

    ??::before {
    display: block;
    content: " ";
    margin-top: -285px;
    height: 285px;
    visibility: hidden;
    pointer-events: none;
    }

    However, when I try to find my anchored item with inspect element I can't see the a class of the item to attribute the CSS above to. Please see my screenshot attached (1) as opposed to how it looks on the Laytheme custom CSS documentation (2)

    so as I don't know what the css selector for the item is, my code is looking like this:

    body.slug-index-6-2 .WHATGOESHERE?::before {
    display: block;
    content: " ";
    margin-top: -285px;
    height: 285px;
    visibility: hidden;
    pointer-events: none;
    }

    The webpage is accessable here: http://box5394.temp.domains/~pollard4/index-6-2
    password : Layforumhelp

    Id appriciate any help very much.

    Thanks,
    Jack!

    [alt text](Screen Shot 2020-04-08 at 18.04.01.png image url)
    Screen Shot 2020-04-08 at 18.30.06.png

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @J-KMB
      you can give this element an extra class and add a padding-top with CUSTOM CSS to it.

      How did you make that the Scroll stops at the headline?
      Best!
      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • J Offline
        J Offline
        J KMB
        wrote on last edited by
        #3

        Hi Marius.

        This worked perfectly, thank you again for your help. I was making it more complicated than it needed to be.

        The single page scroll works with anchor tags and then the custom link menu function.

        Thanks so much

        Jack

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear @J-KMB
          Perfect! Glad to hear!
          Many wishes!
          Marius

          www.mariusjopen.world

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          I also code custom websites or custom Lay features.
          šŸ’æ Email me here: šŸ’æ
          info@laytheme.com

          Before you post:
          1. When using a WordPress Cache plugin, disable it or clear your cache.
          2. Update Lay Theme and all Lay Theme Addons
          3. Disable all Plugins
          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

          This often solves issues you might run into

          When you post:
          1. Post a link to where the problem is
          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
          Online Users
          W
          wua.frank
          arminunruhA
          arminunruh
          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
          laytheme.com
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Search